using System.Collections.Generic;
using UnityEngine;

public class Analytics : MonoBehaviour
{
	private static Analytics instance_;

	private static GameObject instanceGameObject_;

	protected static string tutorialVersion = "1";

	public static Analytics instance
	{
		get
		{
			if (instance_ == null)
			{
				instanceGameObject_ = new GameObject("Analytics");
				Object.DontDestroyOnLoad(instanceGameObject_);
				instance_ = instanceGameObject_.AddComponent<Analytics>();
			}
			return instance_;
		}
	}

	public void StageStarted(string stageName)
	{
		NewDesignEvent("Stages:Start:" + stageName);
	}

	public void StageEnd(string stageName)
	{
		NewDesignEvent("Stages:End:" + stageName);
	}

	public void TutorialStarted()
	{
		NewDesignEvent("Tutorial" + tutorialVersion + ":Start");
	}

	public void TrainingLevel(int level)
	{
		NewDesignEvent("Trainings:Levels:" + level);
	}

	public void DemoEnter()
	{
		NewDesignEvent("Demo:Enter");
	}

	public void DemoUsedClothesThatCostMoney(int times)
	{
		NewDesignEvent("Demo:CostMoney:" + times);
	}

	public void DemoEnd()
	{
		NewDesignEvent("Demo:End");
	}

	public void MoneySpentOnClothes(string name)
	{
		NewDesignEvent("Purchase:Clothes:" + name);
	}

	public void MoneySpentOnTraining(TrainingConfig.Training training)
	{
		NewDesignEvent("Purchase:Training");
		PlayerStatsManager.SkillType skillType = PlayerStatsManager.SkillType.Attack;
		using (List<TrainingConfig.StatUpdateInfo>.Enumerator enumerator = training.statUpdateInfo.GetEnumerator())
		{
			if (enumerator.MoveNext())
			{
				TrainingConfig.StatUpdateInfo current = enumerator.Current;
				skillType = current.skillType;
			}
		}
		NewDesignEvent(string.Concat("Purchase:Training-", skillType, "-", training.price));
	}

	public void MoneySpentOnTrainer()
	{
		NewDesignEvent("Purchase:Trainer");
	}

	public void MoneySpentOnEnergy()
	{
		NewDesignEvent("Purchase:Energy:" + SingletonInit<PlayerCareer>.Instance.maxStageReached);
	}

	public void MoneySpentOnTime(string stageName)
	{
		NewDesignEvent("Purchase:Stage:" + stageName + ":Time");
		NewDesignEvent("Purchase:Stage:Time:" + stageName);
	}

	public void MoneySpentOnContinue(string stageName)
	{
		NewDesignEvent("Purchase:Stage:" + stageName + ":Continue");
		NewDesignEvent("Purchase:Stage:Continue:" + stageName);
	}

	public void MoneySpentOnSkillContinue(PlayerSkills.SkillItem.SkillItemSubstage substage)
	{
		NewDesignEvent("Purchase:Skill:" + substage.skill.nameId + ":" + substage.name);
	}

	public void SkillStarted(PlayerSkills.SkillItem.SkillItemSubstage substage)
	{
		NewDesignEvent("Skill:" + substage.skill.nameId + ":" + substage.name + ":start");
	}

	public void SkillEnd(PlayerSkills.SkillItem.SkillItemSubstage substage, bool isWon)
	{
		NewDesignEvent("Skill:" + substage.skill.nameId + ":" + substage.name + ":complete:" + ((!isWon) ? "lost" : "won"));
	}

	public void SkillUnlocked(PlayerSkills.SkillItem.SkillItemSubstage substage)
	{
		NewDesignEvent("SkillUnlocked:" + substage.skill.nameId);
	}

	public void FacebookDialogOpen()
	{
		NewDesignEvent("Facebook:DialogOpen");
	}

	public void FacebookLogin()
	{
		NewDesignEvent("Facebook:Login");
	}

	public void FacebookLoginSuccess()
	{
		NewDesignEvent("Facebook:LoginSuccess");
	}

	public void FacebookLoginFailded()
	{
		NewDesignEvent("Facebook:LoginFail");
	}

	public void FacebookFriendRequestSent(int count)
	{
		NewDesignEvent("Facebook:FriendRequestsSent:" + count);
	}

	public void ReportTutorialStepComplete(string step, int tries)
	{
		NewDesignEvent("Tutorial" + tutorialVersion + ":Step" + step + ":" + tries);
	}

	public void ReportTutorialComplete()
	{
		NewDesignEvent("Tutorial" + tutorialVersion + ":Complete");
	}

	public void ReportTutorialSkip()
	{
		NewDesignEvent("Tutorial" + tutorialVersion + ":Skip");
	}

	public void ReportMultiplayerMatchStart()
	{
		NewDesignEvent("GameStart:OnlineMultiplayer");
	}

	public void ReportMultiplayerEvent(string e)
	{
		NewDesignEvent("Multiplayer:" + e);
	}

	public void ReportMultiplayerGameMatch(string roomName)
	{
		NewDesignEvent("Stages:Start:" + roomName);
	}

	public void ReportMultiplayerMatchEnd(string roomName)
	{
		NewDesignEvent("GameEnd:OnlineMultiplayer:" + roomName);
	}

	public void ReportMultiplayerRematch(string roomName, bool accepted)
	{
		if (accepted)
		{
			NewDesignEvent("GameEnd:OnlineMultiplayer:Rematch:" + roomName + ":accepted");
		}
		else
		{
			NewDesignEvent("GameEnd:OnlineMultiplayer:Rematch:" + roomName + ":sent");
		}
	}

	public void PlayerReachedNewLevel()
	{
		GGPlayerSettings gGPlayerSettings = GGPlayerSettings.instance;
		NewDesignEvent("User:Share:Level:" + gGPlayerSettings.Level());
	}

	public void ReportPurchase(InAppPurchase.InAppObject purchase)
	{
		if (purchase.type == InAppPurchase.ItemType.Coins)
		{
			NewBusinessEvent("Coins:" + purchase.getsCoins, purchase.currency, purchase.cost);
		}
		else if (purchase.type == InAppPurchase.ItemType.GiraffeDollars)
		{
			NewBusinessEvent("Dollars:" + purchase.getsDollars, purchase.currency, purchase.cost);
		}
		else if (purchase.type == InAppPurchase.ItemType.Tokens)
		{
			NewBusinessEvent("Tokens:" + purchase.getsTokens, purchase.currency, purchase.cost);
		}
		else if (purchase.type == InAppPurchase.ItemType.CoinDollarCombo)
		{
			NewBusinessEvent("CoinsDollarsCombo:" + purchase.getsCoins + ":" + purchase.getsDollars, purchase.currency, purchase.cost);
		}
	}

	public void ReportMessageSent(string message, bool rematch)
	{
		if (rematch)
		{
			NewDesignEvent("Multiplayer:MessageSent:" + message + ":rematch");
		}
		else
		{
			NewDesignEvent("Multiplayer:MessageSent:" + message + ":ingame");
		}
	}

	public void ReportStoryAchivementComplete(GGStoryAchivementBase achivement)
	{
		NewDesignEvent("Story:Complete:" + achivement.index);
	}

	public void ReportStoryShow(GGStoryAchivementBase achivement, bool skipped, int watchedParts)
	{
		if (skipped)
		{
			NewDesignEvent("Story2:Show:" + achivement.index + ":skipped:" + watchedParts);
		}
		else
		{
			NewDesignEvent("Story2:Show:" + achivement.index + ":watched");
		}
	}

	public void ReportLobbyComplete(bool success, string room)
	{
		NewDesignEvent("Multiplayer:Lobby2:" + room + ":" + ((!success) ? "fail" : "success"));
	}

	public void ReportMultiplayerDuration(string room, float numSeconds)
	{
		float val = Mathf.Round(numSeconds / 60f);
		NewDesignEvent("Multiplayer:Durations:" + room, val);
	}

	public void likedFacebookPage()
	{
		NewDesignEvent("User:LikeFacebookPage");
	}

	public void rateAppSuccess()
	{
		NewDesignEvent("User:Rate:Success");
	}

	public void rateAppRateShow()
	{
		NewDesignEvent("User:Rate:Show");
	}

	public void ReportNotificationsOff()
	{
		NewDesignEvent("User:Notifications:Off");
	}

	public void ReportMultiplayerLobbyQuit(string roomType, float time)
	{
		Debug.Log(RoundTime(time));
		NewDesignEvent("Multiplayer:Lobby2:" + roomType + ":fail:", RoundTime(time));
	}

	public void ReportMultiplayerLobbyMatchFound(string roomType, float time)
	{
		NewDesignEvent("Multiplayer:Lobby2:" + roomType + ":success:", RoundTime(time));
	}

	private float RoundTime(float time)
	{
		int num = (int)Mathf.Round(time / 5f);
		return (float)num * 5f;
	}

	public void NewDesignEvent(string name, float val)
	{
	}

	public void NewDesignEvent(string name)
	{
	}

	public void NewBusinessEvent(string eventName, string eventCurrency, int amount)
	{
	}
}
